import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

public class Settings
{
	//static JFrame f_settings;
	static JPanel p_settings;
	static JLabel show;
	static JButton ok,cancel;
//	static JTextField getName;
	static JComboBox<Integer> maxRound;
	
	public static void setting()
	{
		
		//f_AddNPC =new JFrame("添加电脑玩家");
		p_settings = new JPanel();
		p_settings.setBackground(Color.orange);
		show = new JLabel("设置最大局数");
		maxRound = new JComboBox<>(new Integer[]{3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20});
		ok = new JButton("确定");
		cancel = new JButton("取消");
		
		p_settings.add(show);
		p_settings.add(maxRound);
		p_settings.add(ok);
		p_settings.add(cancel);
		
		MainWindow.jf.add(p_settings);
		
		p_settings.repaint();
		MainWindow.jf.setVisible(true);
		
		ok.addActionListener(new AbstractAction()
		{
			@Override
			public void actionPerformed(ActionEvent e)
			{
				Rules.maxRound = maxRound.getSelectedIndex() + 3;
				MainWindow.jf.remove(p_settings);
				MainWindow.windowMenu();
			}
		});
		cancel.addActionListener(new AbstractAction()
		{
			@Override
			public void actionPerformed(ActionEvent e)
			{
				MainWindow.jf.remove(p_settings);
				MainWindow.windowMenu();
			}
		});
		
		//设置：获胜局数，
		//rules.Rules.maxRound = 1;
	}
}
